Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation: wrap local chain info maps with mutexes #669

Merged
merged 2 commits into from
Nov 4, 2024
Merged

Conversation

vdamle
Copy link
Contributor

@vdamle vdamle commented Nov 4, 2024

  • Appears that there's a race when attempting to update local chain ID/Name maps from multiple tests which are kicked off concurrently.
  • Also refactored the code a bit to wrap the global vars into a struct

Checklist

  • I have declared the chain at the appropriate Superchain Level.
  • I have run just validate <chain-id> locally to ensure all local validation checks pass.
  • I have run just codegen to ensure that the chainlist and other generated files are up-to-date and include my chain.

ref: #668

* Appears that there's a race when attempting to update local chain
  ID/Name maps from multiple tests which are kicked off concurrently.
* Also refactored the code a bit to wrap the global vars into a
  struct
@vdamle vdamle requested a review from a team as a code owner November 4, 2024 13:50
@vdamle vdamle requested a review from bitwiseguy November 4, 2024 14:03
Copy link
Collaborator

@geoknee geoknee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you consider using https://pkg.go.dev/sync#Map ?

validation/uniqueness_test.go Outdated Show resolved Hide resolved
@vdamle
Copy link
Contributor Author

vdamle commented Nov 4, 2024

Did you consider using https://pkg.go.dev/sync#Map ?

Thanks for the suggestion, agree that's much simpler to use for this case and modified code accordingly.

@vdamle vdamle requested a review from geoknee November 4, 2024 15:51
@geoknee geoknee added this pull request to the merge queue Nov 4, 2024
Merged via the queue into main with commit 41fa545 Nov 4, 2024
11 checks passed
@geoknee geoknee deleted the vd/issue-668 branch November 4, 2024 16:19
priyanshuthapliyal55 pushed a commit to priyanshuthapliyal55/superchain-registry that referenced this pull request Dec 6, 2024
…m#669)

* Validation: wrap local chain info maps with mutexes

* Appears that there's a race when attempting to update local chain
  ID/Name maps from multiple tests which are kicked off concurrently.
* Also refactored the code a bit to wrap the global vars into a
  struct

* Use sync.Map, simpler code

---------

Co-authored-by: Vinod Damle <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants